package com.nnk.util;

import javax.servlet.http.HttpServletRequest;

import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;

public class Common {
	public static void getUser(HttpServletRequest req){
		UserService userService = UserServiceFactory.getUserService();
        User user = userService.getCurrentUser();
        String authURL = (user != null) ? userService.createLogoutURL(req.getRequestURI()) : userService.createLoginURL(req.getRequestURI());
        req.setAttribute("authURL", authURL);
        req.setAttribute("user", user);
	}
}
